package com.summer.bilibiliLeetcode.singleton;
//单例模式(懒汉式):好处：延迟对象的创建
public class SingletonTest02 {
    public static void main(String[] args) {
        Order order1 = Order.getInstance();
        Order order2 = Order.getInstance();
    }
}
class Order{
    private Order (){}
    private static Order instance = null;
    public static Order getInstance(){
        if (instance == null){
            instance = new Order();
        }
        return instance;
    }
}
